package com.github.cakin.shiro.chapter13.entity;

import java.io.Serializable;

import static com.github.cakin.shiro.chapter13.constant.Constant.NUM31;

/**
 * @className: RolePermssion
 * @description: 角色权限关系实体
 * @date: 2020/5/19
 * @author: cakin
 */
public class RolePermssion implements Serializable {
    /**
     * 角色id
     */
    private Long roleId;
    /**
     * 权限id
     */
    private Long permissionId;

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId( Long roleId ) {
        this.roleId = roleId;
    }

    public Long getPermissionId() {
        return permissionId;
    }

    public void setPermissionId( Long permissionId ) {
        this.permissionId = permissionId;
    }

    @Override
    public boolean equals( Object o ) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        RolePermssion that = (RolePermssion) o;

        if (permissionId != null ? !permissionId.equals(that.permissionId) : that.permissionId != null) {
            return false;
        }
        if (roleId != null ? !roleId.equals(that.roleId) : that.roleId != null) {
            return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        int result = roleId != null ? roleId.hashCode() : 0;
        result = NUM31 * result + (permissionId != null ? permissionId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "RolePermssion{"
                + "roleId=" + roleId
                + ", permissionId=" + permissionId
                + '}';
    }
}
